#内置函数

v1,v2 = divmod(92,10)
print(v1,v2)
data = [1,3,-1]
# 是否所有元素转换成布尔值均为true
print(all(data)) # true 是否所有元素转换成布尔值均为true
print(all([0,9])) # false
# 存在元素为true则返回true
print(any([1,-1,90])) # true
print(any([0,"",[],{}])) #false

#unicode编解码~ 将文字和二进制坐上对应
print(ord("A")) # 返回字符对应的十进制数
print(chr(65)) #基于十进制数返回对应的字符

goods = ["飞机","破鸡排","AK47"]
for idx,item in enumerate(goods,1):
    msg = "{} {}".format(idx,item)
    print(msg)

data_l = [23,45,12,4,1]
#对原数组进行排序
data_l.sort()
print(data_l)

data_l1 = [23,45,12,4,1]
#排序后生成新列表，原列表元素顺序不变，区别于sort()函数
new_l = sorted(data_l1)
print(new_l,data_l1)

#生成1-100的列表
data_list = [ i for i in range(100) ]
#生成元素均为100的列表
data_list1 = [ 100 for i in range(10) ]
data_list2 = [ 100 + i for i in range(10) ]
data_list3 = [100 + i for i in range(10) if 10 < i < 30]
data_list4 = [100,"内控",3,"哦好",(2,4),(4,6),[89,34,1,5,90]]
print([item for item in data_list4 if type(item) == int]) # [100,3]
print([item for item in data_list4 if type(item) == list]) # [[89,34,1,5,90]]
print([item for item in data_list4 if type(item) == tuple]) # [(2, 4), (4, 6)]



print({i:123 for i in range(10)})
print({i:(i,i+100) for i in range(10) if i > 5})

